﻿<%@ Page Title="" Language="C#" MasterPageFile="~/admin1/SiteAdmin.master" AutoEventWireup="true" CodeFile="Hotel.aspx.cs" Inherits="admin1_Hotel" %>
<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>

<%@ Register Assembly="CKFinder" Namespace="CKFinder" TagPrefix="CKFinder" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <style>
        .control-group {
            border-top: 1px solid #ffffff;
            border-bottom: 1px solid #eeeeee;
            margin-bottom: 0;
        }

        .control-label {
            padding-top: 15px;
            width: 180px;
            float: left;
            text-align: right;
        }

        .controls {
            margin-left: 200px;
            padding: 10px 0;
        }
    </style>
    <script src="../ckeditor/ckeditor.js"></script>
    <script src="../ckfinder/ckfinder.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="body" runat="Server">
    <%-- Chinh sua--%>
    <asp:Panel ID="panel_Edit" Width="100%" runat="server" Visible="False">
        <div class="span12">
            <div class="widget-box">
                <div class="widget-title">
                    <span class="icon">
                        <i class="icon-info-sign"></i>
                    </span>
                    <span class="icon1">
                        <asp:LinkButton ID="lbt_ClosEdit" runat="server" OnClick="lbt_ClosEdit_Click"><img src="img/icons/16/close.png" /></asp:LinkButton>
                    </span>
                    <h5>Chỉnh sửa</h5>
                </div>
                <div class="widget-content nopadding">
                    <div class="control-group">
                        <label class="control-label">Mã</label>
                        <div class="controls">
                            <asp:TextBox ID="txt_CatId_Edit" CssClass="NameEdit" runat="server" Enabled="False"></asp:TextBox>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">Loại khách sạn</label>
                        <div class="controls">
                            <asp:TextBox ID="txt_Name_Edit" CssClass="NameEdit" runat="server"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="Chưa nhập loại khách sạn" ControlToValidate="txt_Name_Edit" ValidationGroup="a"></asp:RequiredFieldValidator>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">Ảnh minh họa</label>
                        <div class="controls">
                            <asp:TextBox ID="txt_Image_Edit" runat="server"  Width="800">
                            </asp:TextBox><input id="Browser1" value="Chọn ảnh" type="button" />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Chưa chọn ảnh minh họa" ControlToValidate="txt_Image_Edit" ValidationGroup="a"></asp:RequiredFieldValidator>
                        </div>
                    </div>
                   
                    <div class="control-group">
                        <label class="control-label"></label>
                        <div class="controls">
                            <asp:Button ID="btnSaveEdit" runat="server" Text="Save Change" class="btn btn-success" OnClick="btnSaveEdit_Click" />
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </asp:Panel>
    <%-- Thêm mới --%>
    <asp:Panel ID="panel_Add" Width="100%" runat="server" Visible="False">
        <div class="span12">
            <div class="widget-box">
                <div class="widget-title">
                    <span class="icon">
                        <i class="icon-info-sign"></i>
                    </span>
                    <span class="icon1">
                        <asp:LinkButton ID="lbt_ClosAdd" runat="server" OnClick="lbt_ClosAdd_Click"><img src="img/icons/16/close.png" /></asp:LinkButton>
                    </span>
                    <h5>Thêm mới</h5>
                </div>
                <div class="widget-content nopadding">
                    <div class="control-group">
                        <label class="control-label">Loại khách sạn</label>
                        <div class="controls">
                            <asp:TextBox ID="txt_Name" runat="server" CssClass="null" ValidationGroup="a"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Chưa nhập loại khách sạn!" ControlToValidate="txt_Name" ValidationGroup="a"></asp:RequiredFieldValidator>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">Ảnh minh họa</label>
                        <div class="controls">
                             <asp:TextBox ID="txt_ImageAdd" runat="server"  Width="800">
                            </asp:TextBox><input id="Browser" value="Chọn ảnh" type="button" />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="Chưa chọn ảnh minh họa" ControlToValidate="txt_ImageAdd" ValidationGroup="a"></asp:RequiredFieldValidator>
                        </div>
                    </div>
                    
                    <div class="control-group">
                        <label class="control-label"></label>
                        <div class="controls">
                            <asp:Button ID="btnInsert" runat="server" Text="Save" class="btn btn-success" OnClick="btnInsert_Click" ValidationGroup="a" />

                        </div>
                    </div>

                </div>
            </div>
        </div>
    </asp:Panel>


    <%#Eval("CatId") %>
    <%-- Hien thi thong tin --%>
    <div class="row-fluid" style="margin-top: 10px;">
        <div class="span12">
            <div class="widget-box">
                <div class="widget-title">
                    <span class="icon"><i class="icon-th"></i></span>
                    <asp:LinkButton ID="lbt_Add_New" runat="server" OnClick="lbt_Add_New_Click"><img src="img/icons/16/add.png"  width="34" /></asp:LinkButton>
                </div>
                <div class="widget-content nopadding">
                    <table class="table table-bordered data-table">
                        <thead>
                            <tr>
                                <th>Mã</th>
                                <th>Loại khách sạn</th>
                                <th>Hình ảnh</th>
                                <th>Chức năng</th>
                            </tr>
                        </thead>

                        <tbody>
                            <asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="pu_load">
                                <ContentTemplate>

                                    <asp:Repeater ID="rpt_Category" runat="server">
                                        <ItemTemplate>
                                            <tr class="gradeX">
                                                <td class="center"><%#Eval("HotelId") %></td>
                                                <td><%#Eval("Name") %></td>
                                                <td class="center"> <img  class="img_prod" src="<%#Eval("Images") %>" /></td>
                                                <td class="center">
                                                    <asp:LinkButton ID="lbt_ChinhSua" CommandArgument='<%#Eval("HotelId") %>' runat="server" OnClick="lbt_ChinhSua_Click" ToolTip="Chinh sửa"><img src="img/icons/16/create.png" width="16" height="18"/></asp:LinkButton>
                                                    &nbsp;&nbsp;<asp:LinkButton ID="btnxoa" CommandArgument='<%#Eval("HotelId") %>' runat="server" OnClick="btnxoa_Click" ToolTip="Xóa" OnClientClick="return confirm('Bạn có chắc chắn muốn xóa?')"><img src="img/icons/16/delete.png" width="16" height="18"/></asp:LinkButton>
                                                </td>
                                            </tr>
                                        </ItemTemplate>
                                    </asp:Repeater>

                                </ContentTemplate>
                            </asp:UpdatePanel>
                        </tbody>

                    </table>
                </div>
            </div>

        </div>
    </div>
    <script language="javascript" type="text/javascript">
        $(function () {
            $("#Browser").click(function () {
                var ckfinder = new CKFinder();
                ckfinder.selectActionFunction = function (fileUrl) {
                    $("#body_txt_ImageAdd").val(fileUrl);
                };
                ckfinder.popup();
            });
            $("#Browser1").click(function () {
                var ckfinder = new CKFinder();
                ckfinder.selectActionFunction = function (fileUrl) {
                    $("#body_txt_Image_Edit").val(fileUrl);
                };
                ckfinder.popup();
            });
        });

    </script>
</asp:Content>